#ifndef SCRIPTENVIRONMENT_H
#define SCRIPTENVIRONMENT_H

#include <defs/global.h>
#include <core/entityobject.h>
#include <QtScript>


namespace Opl{ namespace Scripting {

O_PRIVATE_DECLARE(ScriptEnvironment);
class SCRIPTING_EXPORT ScriptEnvironment : public Opl::Core::EntityObject, QScriptable
{
    Q_OBJECT
public:

    enum ScriptEnvironmentMode
    {
        minimal,
        zone,
        application,
        plugin,
        full
    };

    ScriptEnvironment(ScriptEnvironmentMode mode, Opl::Core::EntityObject *parent = 0);
    virtual ~ScriptEnvironment();
    virtual void initialize() = 0;
    virtual const QString& errorString()const = 0;
    virtual void registerObject(const QString& name, Opl::Core::EntityObject* object, const QString& package = "") = 0;
signals:
    void output(const QString& str);
    void error(const QScriptValue & exception);    

public slots:
    virtual bool exec(const QString& script, bool debug) = 0;
    virtual bool exec(const QString& script, const QString& filename = QString(), bool debug = false) = 0;

private:
    O_PRIVATE_DECLARE_MEMBER(ScriptEnvironment)
};
}}

#endif // SCRIPTENVIRONMENT_H
